#include<stdio.h>
int main()
{	      	  
    int a, b, c, m, n;
    printf("Input m:");
    scanf("%d", &m);
    n = 0;
    for (a=1; a<=m; a++)//2
    {	      	  
        for (b=1; b<=m; b++)//2
        {	      	  
            for (c=1; c<=m; c++)//2
            {	      	  
                if (a * a + b * b == c * c && a < b && b < c) //2
                {	      	  
                    printf("%d %d %d\n", a, b, c);//1
                    n++;//1
                }
            }
        }
    }
    printf("count=%d\n", n);
    return 0;
}